package com.file.system.plugin.validated;

import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class SQLInjectionValidator implements ConstraintValidator<SQLInjectionValidation, String> {


    private String fieldName;
    private boolean enableValidation;

    //初始化方法，用于获取注解中的属性值
    @Override
    public void initialize(SQLInjectionValidation constraintAnnotation) {
        // 获取注解中的字段名
        fieldName = constraintAnnotation.fieldName();
        // 获取注解中的验证状态
        enableValidation = constraintAnnotation.enableValidation();
    }


    // 判断是否启用验证
    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        return true;
    }
}